package cn.wsn2018.tools.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 将常用字符串作为静态常量放置此处,避免使用硬编码的不良习惯
 */
public class CommonValue {
    //mongodb日志集合名
    public static final String WARN_COLLLECTION="warningLogInfo";
    public static final String ERROR_COLLLECTION="errorLogInfo";


    //排序
    public static final String AESC="0";
    public static final String DESC="1";

    public static final String FUNCTION_AUTHNEGO = "authNego";
    public static final String FUNCTION_ENCRYPTNEGO = "encryptNego";
    public static final String FUNCTION_ENCRYPT = "encrypt";
    public static final String FUNCTION_EXCEPTION = "exception";
    public static final String FUNCTION_VIRUS = "virus";
    public static final String FUNCTION_RESEND = "resend";
    public static final String FUNCTION_INTEGRITY = "integrity";
    public static final String JSON_INSERT_SUCCESS="插入成功";
    public static final String JSON_INSERT_FAILED="插入失败";
    public static final String JSON_USERNAME_EXIST="用户名已存在";
    public static final String JSON_USERNAME_AVAILABLE="用户名可用";
    public static final String JSON_USERNAME_NOTEXIST="用户不存在";
    public static final String JSON_PASSWORD_FAILED="用户密码错误";
    public static final String JSON_CREATE_USER_SUCCESS="添加成功";
    public static final String JSON_LOGIN_SUCCESS="登录成功";
    public static final String JSON_lOGIN_FAILED="登录失败";
    public static final String JSON_LOCK_ACCOUNT_lOGIN_FAILED="账号已锁定,请联系管理员或等待锁定时间结束";
    public static final String JSON_ILLEGAL_IP_LOGIN="IP地址异常,登录失败";
    public static final String JSON_LOGIN_TIME_ERROR="非允许访问时段,登录失败";
    public static final String JSON_SLEEP_ACCOUNT_lOGIN_FAILED="账号已过期,请联系管理员";
    public static final String JSON_LOGIN_FAILED_CONCURRENCY="用户最大并发数已满";
    public static final String JSON_LOGIN_FAILED_REPLAY="新鲜性验证失败，您可能遭到了重放攻击";
    public static final String JSON_LOGIN_SUCCESS_ISLOGINED="登录成功，已使相同账号的用户被迫下线，对方任意操作后将跳转到登录页面";
    public static final String JSON_QUERY_SUCCESS="查询成功";
    public static final String JSON_QUERY_FAILED="查询失败";
    public static final String JSON_STATISTICAL_SUCCESS="统计成功";
    public static final String JSON_STATISTICAL_NULL="无相关记录";
    public static final String JSON_NO_ANY_DATA="NoAnyData";
    public static final String JSON_INPUT_ERROR="输入参数有误";
    public static final String JSON_QUERY_NULL="查询结果为空";
    public static final String JSON_UPDATE_SUCCESS="修改成功";
    public static final String JSON_UPDATE_FAILED="修改失败";
    public static final String JSON_DELETE_SUCCESS="删除成功";
    public static final String JSON_DELETE_FAILED="删除失败";
    public static final String JSON_LOGIN_ONLINE="online";
    public static final String JSON_NOT_LOGIN="notlogin";
    public static final String JSON_LOGOUT_SUCCESS="登出成功";
    public static final String JSON_LOGOUT_FAILED="登出失败";
    public static final String JSON_ROLE_ERROR="权限不够";
    public static final String JSON_TEST_FINISH="测试完成";
    public static final String JSON_MODEL_SUCCESS="切换模式成功";
    public static final String JSON_MODEL_FAILED="切换模式失败";
    public static final String JSON_IDCODE_SUCCESS="成功获取验证码";
    public static final String JSON_CHECKIDCODE_SUCCESS="验证码正确";
    public static final String JSON_CHECKIDCODE_FAILED="验证码错误";
    public static final String JSON_USERINFO_NULL="缺少用户基本信息";
    public static final String JSON_FIRST_LOGIN="firstlogin";
    public static final String JSON_NOTFIRST_LOGIN="notfirstlogin";
    public static final String JSON_AUTHORIZATION_SUCCESS="授权状态查询成功";
    public static final String JSON_AUTHORIZATION_FAILED="授权状态查询失败";
    public static final String JSON_ASK_AUTHORIZED_SUCCESS="用户请求授权成功";
    public static final String JSON_ASK_AUTHORIZED_FAILED="用户请求授权失败";
    public static final String JSON_ASK_AUTHORIZED="用户向管理员请求授权";

    public static final String DEFAULT_PASSWORD="888888";
//    public static final String CREATE_TYPE="create";
//    public static final String UPDATE_TYPE="update";
//    public static final String DELETE_TYPE="delete";
//    public static final String LOGIN_TYPE="login";
//    public static final String LOGOUT_TYPE="logout";
//    public static final String TEST_TYPE="test";
    public static final String CREATE_TYPE="新建";
    public static final String UPDATE_TYPE="修改";
    public static final String DELETE_TYPE="删除";
    public static final String LOGIN_TYPE="登录";
    public static final String LOGOUT_TYPE="登出";
    public static final String AUTH_TYPE="鉴权";
    public static final String TEST_TYPE="测试";
    public static final String SELECTED_TYPE="查询";
    public static final String STATISTICAL_TYPE="统计";
    public static final String BACK_UP_LOGS="备份";
//    public static final String AUTHORITIES_TYPE="授权";
    public static final String SUCCESS="success";
    public static final String FAILED="fail";
    public static final String CREATE_USER_LOGINFO="新建用户";
    public static final String UPDATE_USER_LOGINFO="更新用户";
    public static final String DELETE_USER_LOGINFO="删除用户";
    public static final String UPDATE_PWD="用户修改登录密码";
    public static final String LOGIN_LOGINFO="登录访问";
    public static final String LOGOUT_LOGINFO="登出下线";
    public static final String AUTH_LOGINFO="管理员身份鉴别";
    public static final String CREATE_DESIGN_LOGINFO="新建协议设计";
    public static final String UPDATE_DESIGN_LOGINFO="更新协议设计";
    public static final String DELETE_DESIGN_LOGINFO="删除协议设计";
    public static final String CREATE_CONFIG_LOGINFO="新建协议配置";
    public static final String UPDATE_CONFIG_LOGINFO="更新协议配置";
    public static final String DELETE_CONFIG_LOGINFO="删除协议配置";
    public static final String TEST_CONFIG_LOGINFO="测试协议";
    public static final String CREATE_TESTREPORT_LOGINFO="新建协议测试报告";
    public static final String DELETE_TESTREPORT_LOGINFO="删除协议测试报告";
    public static final String PRE_MESSAGE_SEND="预处理信息发送";
    public static final String CHECK_FIRST="FirstLoginCheck";
    public static final String ASk_AUTHORIZED="AskAuthorization";


    public static final String ROLE_ADMIN="admin";
    public static final String ROLE_AUDITOR="auditor";  //业务审计员
    public static final String ROLE_SYS_AUDITOR="sysAuditor";   //系统审计员
    public static final String ROLE_OPERATOR="operator";
    //public static final String IP = "192.168.1.10";
    public static final String IP = "127.0.0.1";
    public static final String REMOTE="119.29.242.75:2701";
    public static final String PORT = "80";
    public static final String PARAM = "/cgi-bin/protocol_tools/tools.cgi?";
    public static final String URL = "http://" + IP + ":" + PORT+PARAM;

    public static final String WARNINGLOGMODULE ="告警日志模块";
    public static final String ERRLOGMODULE ="错误日志模块";
    public static final String LOGMODULE ="业务日志模块";

    public static final String DESIGNMODULE="协议设计模块";
    public static final String TESTMODULE="协议测试模块";
    public static final String BROWSEMODULE="协议预览模块";

    public static final String LOGIN_MODULE="系统登陆模块"; //0
    public static final String OPERATOR_MODULE="操作员模块"; //1
    public static final String AUDITOR_MODULE="业务审计员模块";   //2
    public static final String SYS_AUDITOR_MODULE="系统审计员模块";    //3
    public static final String ADMIN_MODULE="系统管理员模块";  //4

    //日志
    public static final Integer LOG_TYPE_BUS=0;
    public static final Integer LOG_TYPE_SYS=1;
    //告警日志
    public static  final String WARNING_TYPE_0="账号异常";
    public static  final String WARNING_TYPE_1="越权访问";
    public static  final String WARNING_LEVEL_0="严重";
    public static  final String WARNING_LEVEL_1="一般";


    //安全用户
    //未锁定
    public static final Integer USER_UNLOCK=0;
    //锁定
    public static final Integer USER_LOCK=1;

    public static final String  LOCK_USER="锁定用户";
    public static final String  UNLOCK_USER="解锁用户";

    //账号状态
    public static final Integer STATE_DEL=0;
    public static final Integer STATE_SLEEP=1;
    public static final Integer STATE_ACTIVE=2;

    public static final String ACTIVE_USER="激活用户";
    public static final String SLEEP_USER="休眠用户";
    public static final String DELETE_USER="注销用户";

    //账号类型
    //临时账户
    public static final Integer TYPE_TEMPORARY_0=0;
    //永久账户
    public static final Integer TYPE_PERMANENT_1=1;

    //访问时间
    //全天
    public static final Integer ACCESS_TIME_0=0;
    //8:30-17:00
    public static final Integer ACCESS_TIME_1=1;
    //8:30-11:30
    public static final Integer ACCESS_TIME_2=2;
    //13:30-17:00
    public static final Integer ACCESS_TIME_3=3;

    //可访问时间
    public static final String ACCESS_TIME_00_00="00:00:00";
    public static final String ACCESS_TIME_23_59="23:59:59";
    public static final String ACCESS_TIME_8_30="08:30:00";
    public static final String ACCESS_TIME_11_30="11:30:00";
    public static final String ACCESS_TIME_13_30="13:30:00";
    public static final String ACCESS_TIME_17_00="17:00:00";



    //权限管理
    //用户请求授予权限
    public static final Integer ASK_PERMISSION=0;
    //未授予权限
    public static final Integer NO_PERMISSION=1;
    //已授予权限
    public static final Integer HAS_PERMISSION=2;

    //
    public static final String USER_INFO_UPDATE="用戶信息更新";
    public static final String USER_RESET_PWD="重置用户密码";
    public static final String SYSTEM_CONFIG="系统配置参数更新";
    public static final String SYSTEM_SCHEDULE_TASK="系统定时任务";
    public static final String SYSTEM_SCHEDULE_USER="/";

    //注销
    public static final String USER_REMOVE_SUCCESS="用户注销成功";
    public static final String USER_REMOVE_FAILED="用户注销失败";

    public static final String USER_ACTIVE_SUCCESS="用户激活成功";
    public static final String USER_ACTIVE_FAILED="用户激活失败";
    public static final String USER_SLEEP_SUCCESS="用户休眠成功";

    public static final String USER_LOCK_SUCCESS="用户锁定成功";
    public static final String USER_LOCK_FAILED="用户锁定失败";

    public static final String USER_UNLOCK_SUCCESS="用户解锁成功";
    public static final String USER_UNLOCK_FAILED="用户解锁失败";

    public static final String USER_GIVEN_PERMISSION="授权用户";
    public static final String USER_REMOVE_ERMISSION="移除用户权限";
    public static final String USER_GIVEN_PERMISSION_SUCCESS="授权成功";
    public static final String USER_GIVEN_PERMISSION_FAILED="授权失败";


    public static final String USER_REMOVE_PERMISSION_SUCCESS="移除权限成功";
    public static final String USER_REMOVE_PERMISSION_FAILED="移除权限失败";

    public static final String USER_RESET_PWD_SUCCESS="重置密码成功";
    public static final String USER_RESET_PWD_FAILED="重置密码失败";
    public static final String USER_RESET_PWD_FAILED_USER_NULL="用户不存在,重置密码失败";
    public static final String USER_RESET_PWD_FAILED_USER_ID_NULL="用户身份证信息缺失,重置密码失败";

    public static final String USER_QUERY_SUCCESS="用户查找成功";
    public static final String USER_QUERY_FAILED="用户查找失败";

    public static final String USER_INFO_UPDATE_SUCCESS="用户信息修改成功";
    public static final String USER_INFO_UPDATE_FAILED="用户信息修改失败";

    public static final String SYSTEM_CONFIG_SUCCESS="系统参数配置修改成功";
    public static final String SYSTEM_CONFIG_FAILED="系统参数配置修改失败";

    public static final String GET_SYSTEM_CONFIG_SUCCESS="获取系统配置成功";
    public static final String GET_SYSTEM_CONFIG_FAILED="获取系统配置失败";

    public static  Integer SESSION_OUT_OF_TIME=7200;

    public static final long ONE_GB= 1024*1024*1024;
    public static final long ONE_MB= 1024*1024;
    public static final long ONE_KB= 1024;
    public static final String ERROR_LOG="ErrorLog.log";
    public static final String WARN_LOG="WarnLog.log";
    public static final String USER_LOG="UserLog.log";


    public static final Map<String,String> protocolMap = new HashMap<String,String>(){
        {
            put("IEC-60870-5-101", "101");
            put("IEC-60870-5-104", "104");
            put("IEC-61850-MMS", "MMS");
            put("IEC-61850-SV", "SV");
            put("IEC-61850-GOOSE", "GOOSE");
            put("DNP3", "DNP3");
        }
    };


}
